<template>
    <div>
        <div style="width:14%;height: 130px;border-radius: 100px;">
            <img style="width:auto;height: 125%; " :src="user.userImage" class="image">
        </div>

        <br>
        <br>
        <el-descriptions :column="1"  
       
        border>

            <el-descriptions-item label="用户名" v-model="userName" >
                <p class="message">{{user.userName}}</p>
            </el-descriptions-item>
            <el-descriptions-item label="邮箱号" v-model="email" class="message">
                <p class="message">{{user.email}}</p>
            </el-descriptions-item>
            <el-descriptions-item label="联系方式" v-model="userPhone" class="message">
                <p class="message">{{user.userPhone}}</p>
            </el-descriptions-item>
            <el-descriptions-item label="账户余额" v-model="userPhone" class="money">
                <p class="money">{{user.money}}</p>
            </el-descriptions-item>
            

        </el-descriptions>
        
    </div>
</template>
    
<script>
import { user } from "@/utils/testData";


export default {
    name: "showinfo",
  
    data() {
        return {
         

            userName: "",
            userPhone: "",
            userImage: "",
            email: "",
            user: {
                id: "",
                userName: "",
                userPhone: "",
                userImage: "",
                email: "",
            },
        };
    },
    methods: {
    
        initUser: function () {
            var tokenObject = this.$Storage.getItemForLs(this.$TestData.TOKEN_OBJECT_KEY);
            this.$Request
                .fetch("/api/rentuser/user/" + tokenObject.aud, {})
                .then((result) => {
                this.user = result;
                // console.log(this.user);
                // 设置默认头像
                if (this.user.userImage == null || this.user.userImage == "") {
                    this.user.userImage = "/img/default_big.jpg";
                    console.log(this.user.userImage);
                }
                if(!this.user.userImage.includes("/img/default_big.jpg")){
					
					this.user.userImage="http://127.0.0.1:8000"+this.user.userImage;
					}
            })
                .catch(() => { });
        },
    },
    mounted() {
        this.initUser();
    },
}
</script>
    
<style scoped>
.message {
    width: 20em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
</style>
   